var findKthPositive = function (arr, k) {
    let count = 0
    if (arr[0] !== 1) {
        count += (arr[0] - 1)
        if (count >= k) {
            return arr[0] -= (count - k + 1)
        }
    }
    for (let i = 1; i < arr.length; i++) {
        if (arr[i] - arr[i - 1] !== 1) {
            count += (arr[i] - arr[i - 1] - 1)
            if (count >= k) {
                return arr[i] -= (count - k + 1)
            }
        }
    }
    return arr[arr.length - 1] + (k - count)
}